package plus.chendd.lock;

public class EndThread003 {
  public static void main(String[] args) throws InterruptedException {
    // interrupt的状态 默认是false
    System.out.println(Thread.currentThread().isInterrupted());
    
    // 执行打断后 再次查看状态
    Thread.currentThread().interrupt();
    // 打断标记后，直接设置为true
    System.out.println(Thread.currentThread().isInterrupted());
    System.out.println(Thread.currentThread().isInterrupted());
    
    // 返回当前线程，并归位为false interrupt标记位：true
//    System.out.println(Thread.interrupted());
    // 已经归位
//    System.out.println(Thread.interrupted());
//
//    Thread t1 = new Thread(() -> {
//      while (!Thread.currentThread().isInterrupted()) {
//
//      }
//      System.out.println("线程结束");
//    });
//
//    t1.start();
//    Thread.sleep(2000);
//    t1.interrupt();
  }
}
